﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;

namespace VietGlobalSoft.SellsManagement.App
{
    public partial class frmMain : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void barbuttonPhieuNhapKho_ItemClick(object sender, ItemClickEventArgs e)
        {
            
        }

        void pnContent_LoadControl(Control control,BarButtonItem barButton,string title)
        {
            pnContent.Controls.Clear();
            pnContent.Controls.Add(control);

            pbTitle_Icon.Image = imglistLarge.Images[barButton.LargeImageIndex];
            lblTitle.Text = title;
        }

        private void barbuttonKhuVuc_ItemClick(object sender, ItemClickEventArgs e)
        {
            pnContent_LoadControl(new ucDanhMucKhuVuc() { Dock = DockStyle.Fill }, barbuttonKhuVuc,"Danh mục khu vực");
            
        }

        private void cUSTOMERBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.cUSTOMERBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dSSellsManagementDB);

        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dSSellsManagementDB.CUSTOMER' table. You can move, or remove it, as needed.
            this.cUSTOMERTableAdapter.Fill(this.dSSellsManagementDB.CUSTOMER);

        }

        private void pnMain_SizeChanged(object sender, EventArgs e)
        {
            pnContent.Height = pnMain.Height - pnTitle.Height;
        }

        private void barbuttonBanHang_ItemClick(object sender, ItemClickEventArgs e)
        {
            pnContent_LoadControl(new ucHoaDonMuaHang() { Dock = DockStyle.Fill }, barbuttonBanHang, "Hóa đơn bán hàng");
        }

        private void barbuttonKhachHang_ItemClick(object sender, ItemClickEventArgs e)
        {
            pnContent_LoadControl(new ucDanhMucKhachHang() { Dock = DockStyle.Fill }, barbuttonKhachHang, "Danh mục khách hàng");
        }

        private void barbuttonNhaCungCap_ItemClick(object sender, ItemClickEventArgs e)
        {
            pnContent_LoadControl(new ucDanhMucNhaCungCap() { Dock = DockStyle.Fill }, barbuttonNhaCungCap, "Danh mục nhà cung cấp");
        }

        private void barbuttonKhoHang_ItemClick(object sender, ItemClickEventArgs e)
        {
            pnContent_LoadControl(new ucDanhMucKhoHang() { Dock = DockStyle.Fill }, barbuttonKhachHang, "Danh mục kho hàng");
        }

        private void barbuttonDonViTinh_ItemClick(object sender, ItemClickEventArgs e)
        {
            pnContent_LoadControl(new usDanhMucDonViTinh() { Dock = DockStyle.Fill }, barbuttonDonViTinh, "Danh mục đơn vị tính");
        }
    }
}